package com.easypan.entity.po;


import java.util.Date;
import com.easypan.entity.enums.DateTimePatternEnum;
import com.easypan.utils.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;


/**
 * 用户信息
 */
@Data
public class UserInfo implements Serializable {


    /**
     * 用户ID
     */
    private String userId;

    /**
     * 昵称
     */
    private String nickName;

    /**
     * 邮箱
     */
    private String email;

    /**
     * qq 头像
     */
    private String qqAvatar;

    /**
     * qq openID
     */
    private String qqOpenId;

    /**
     * 密码
     */
    private String password;

    /**
     * JSON序列化/反序列化时使用"yyyy-MM-dd HH:mm:ss"格式和时区GMT+8
     * Spring MVC参数绑定时也使用该日期格式进行转换
     */
    /**
     * 加入时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date joinTime;

    /**
     * 最后登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    /**
     * 0:禁用 1:正常
     */
    private Integer status;

    /**
     * 使用空间单位byte
     */
    private Long useSpace;

    /**
     * 总空间单位byte
     */
    private Long totalSpace;


    @Override
    public String toString() {
        return "用户ID:" + (userId == null ? "空" : userId) + "，昵称:"
                + (nickName == null ? "空" : nickName) + "，邮箱:" +
                (email == null ? "空" : email) + "，qqAvatar:" +
                (qqAvatar == null ? "空" : qqAvatar) + "，qqOpenId:" +
                (qqOpenId == null ? "空" : qqOpenId) + "，密码:" +
                (password == null ? "空" : password) + "，加入时间:" +
                (joinTime == null ? "空" : DateUtil.format(joinTime,
                        DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern())) +
                "，最后登录时间:" + (lastLoginTime == null ? "空" : DateUtil.format(lastLoginTime,
                DateTimePatternEnum.YYYY_MM_DD_HH_MM_SS.getPattern())) +
                "，0:禁用 1:正常:" + (status == null ? "空" : status) + "，useSpace:" +
                (useSpace == null ? "空" : useSpace) + "，totalSpace:" +
                (totalSpace == null ? "空" : totalSpace);
    }
}
